package com.zlp.dto.resource;

import com.zlp.enums.resource.ComponentDetailEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
@ApiModel(value = "组件返回参数")
public class ComponentResp implements Serializable {

    @ApiModelProperty(value = "组件名称 (图片;标题;魔方;商品)")
    private String componentName;

    @ApiModelProperty(value = "组件类型 (100:图片;200:标题;300:魔方;400:商品)")
    private Integer componentType;

    @ApiModelProperty(value = "组件明细名称")
    private String componentDetailName;

    @ApiModelProperty(value = "组件明细类型 (10:图片-Banner位; " +
            "20:标题-标题文本; " +
            "30:魔方-活动魔方-1排2个;31:魔方-活动魔方-1排1个;32:魔方-活动魔方-1排N个;33:魔方-活动魔方-1左2右; " +
            "40:话题-社区话题;" +
            "50:图片-产品Banner;" +
            "60:魔方-商品长图;" +
            "70:商品-商品图+商品信息;" +
            "80:魔方-商品长图;" +
            "90:商品-活动商品)")
    private Integer componentDetailType;


    @ApiModelProperty(value = "端上组件名称")
    private String component;



    /**
     * 枚举转换具体对象信息
     */
    public static ComponentResp convertComponent(ComponentDetailEnum componentDetailEnum){
        ComponentResp componentResp = new ComponentResp();
        componentResp.setComponentName(componentDetailEnum.getComponentName());
        componentResp.setComponentType(componentDetailEnum.getComponentType());
        componentResp.setComponentDetailName(componentDetailEnum.getComponentDetailName());
        componentResp.setComponentDetailType(componentDetailEnum.getComponentDetailType());
        componentResp.setComponent(componentDetailEnum.getComponent());
        return componentResp;

    }



}